home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / wgt_tp1.zip / WGT05.PAS < prev    next >
Pascal/Delphi Source File  |  1992-07-05  |  2KB  |  49 lines

  1. {**************************************************************************
  2.                           WordUp Graphics Toolkit
  3.                                  Demo File
  4.  
  5.  This program shows how the REGIONFILL command works. The screen is filled
  6.  with random pixels, and the user selects a fill point with the mouse.
  7.  **************************************************************************}
  8.  
  9. {First we must tell the compiler to use whatever memory it can}
  10.  
  11. {$M 65520,0,655360}
  12.  
  13. USES Graph,WGT;
  14.  
  15. VAR
  16.    grDriver, grMode : integer;
  17.    x, y, button : integer;
  18.  
  19. BEGIN
  20.      grDriver := INSTALLUSERDRIVER('VGA256',NIL);
  21.      grMode := 0;
  22.      INITGRAPH(grDriver,grMode,'c:\tp\bgi');
  23.  
  24.      {Place 20,000 random pixels on the screen}
  25.      for x:=1 to 20000 do _putpixel(random(320),random(200),40);
  26.  
  27.      mouse_on;
  28.  
  29.      {Now wait until the user hits the left mouse button, then fill the
  30.       screen starting from that point. Press the right mouse button to
  31.       end the program.}
  32.  
  33.      repeat
  34.            mouse(x,y,button);
  35.            if button=1 then begin
  36.               mouse_off;
  37.               _setcolor(30);
  38.               regionfill(x,y);
  39.               mouse_on;
  40.            end;
  41.      until button=2;
  42.  
  43.      {Note: After the program runs, hit CTRL-F4 and enter MEMORY_USAGE.
  44.             This will tell you how much memory the fill required for that
  45.             particular run. Try changing the number of pixels, or drawing
  46.             some circles, etc. instead. }
  47.  
  48.      CLOSEGRAPH;
  49. END.